
package ch.hearc.coursJava.GUI.j2D;

import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.Toolkit;
import java.awt.geom.Line2D;
import java.awt.geom.Rectangle2D;

import javax.swing.ImageIcon;
import javax.swing.JButton;

import ch.hearc.coursJava.GUI.j2D.tools.JPanelDessin_A;

public class JPanelJ2DHello extends JPanelDessin_A
	{

	/*------------------------------------------------------------------*\
	|*							Constructeurs							*|
	\*------------------------------------------------------------------*/

	public JPanelJ2DHello()
		{
		rectangle = new Rectangle2D.Double(10, 20, 50, 100);
		line = new Line2D.Double(50, 50, 100, 100);
		color = new Color(17, 25, 84);
		stringHello = "coucou";
		fontHelvetica = new Font("Courrier", Font.ITALIC + Font.BOLD, 20);

		imageRose = new ImageIcon("rose.png").getImage();
		imageFirefox = Toolkit.getDefaultToolkit().getImage("Firefox.png");

		System.out.println("hauteur = " + imageRose.getHeight(null) + " largeur = " + imageRose.getWidth(null));
		System.out.println("hauteur = " + imageFirefox.getHeight(null) + " largeur = " + imageFirefox.getWidth(null));

		imageAttention = new ImageIcon("Att.png");
		bouton = new JButton();
		add(bouton);
		bouton.setIcon(imageAttention);
		}

	/*------------------------------------------------------------------*\
	|*							Methodes Public							*|
	\*------------------------------------------------------------------*/

	/*------------------------------------------------------------------*\
	|*							Methodes Private						*|
	\*------------------------------------------------------------------*/



	@Override
	protected void dessiner(Graphics2D g2D)
		{
		g2D.drawImage(imageFirefox, 200, 0, 200, 100, this);
		g2D.drawImage(imageRose, 50, 100, 200, 100, null);
		g2D.setFont(fontHelvetica);

		g2D.setColor(color);
		g2D.draw(line);

		g2D.drawString(stringHello,50,50);

		g2D.draw(rectangle);
		g2D.translate(300, 300);
		g2D.rotate(2 * Math.PI / 3);
		g2D.fill(rectangle);
		g2D.scale(-1, 1);
		g2D.fill(rectangle);

		}

	/*------------------------------------------------------------------*\
	|*							Attributs Private						*|
	\*------------------------------------------------------------------*/

	private Rectangle2D rectangle;
	private Line2D line;
	private Color color;
	private String stringHello;
	private Font fontHelvetica;
	private JButton bouton;

	private Image imageRose;
	private Image imageFirefox;
	private ImageIcon imageAttention;


	}
